package com.example.cdctest.service.impl;

import com.example.cdctest.mapper.ConfigMapper;
import com.example.cdctest.pojo.Config;
import com.example.cdctest.service.ConfigService;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)
public class ConfigServiceImpl implements ConfigService {

    @Resource
    private ConfigMapper configMapper;

    @Override
    public void insert(Config object) {

    }

    @Override
    public void delete(Integer id) {

    }

    @Override
    public void delete(String ids) {

    }

    //根据配置信息的Id,修改配置信息的状态值
    @Override
    public void update(Config object) {
        configMapper.updateByPrimaryKey(object);
    }

    @Override
    public Config findById(Integer id) {
        return null;
    }

    @Override
    public List<Config> findAll() {
        return configMapper.selectAllConfig();
    }

    @Override
    public PageInfo<Config> findPage(int pageSize) {
        return null;
    }

    //获得有多少条数据
    @Override
    public Integer getConfigCount() {
        return configMapper.selectCount();
    }

    //一键还原默认，修改状态值与默认值一致
    @Override
    public void reductionValue() {
        configMapper.updateValue();
    }
}
